#ifndef __EPOLLTEST_HEADER__
#define __EPOLLTEST_HEADER__
#include <sys/select.h>
#include <string.h>
#include <sys/socket.h>
#include <netdb.h>
#define ANET_ERR_LEN 256
#define ANET_PORT_LEN 6
#define DEFAULT_TCP_BACKLOG 511
#define NET_IP_STR_LEN 46 /* INET6_ADDRSTRLEN is 46, but we need to be sure */

#define AE_OK 0
#define AE_ERR -1

#define AE_NONE 0     /* No events registered. */
#define AE_READABLE 1 /* Fire when descriptor is readable. */
#define AE_WRITABLE 2 /* Fire when descriptor is writable. */
#define AE_BARRIER 4  /* With WRITABLE, never fire the event if the*/
#define UNUSED(V) ((void)V)

#define ANET_OK 0
#define ANET_ERR -1
#define ANET_ERR_LEN 256

typedef struct epollEvent
{
    int mask; //one of AE_(READABLE|WRITEABLE|BARRIER)
    aeFileProc *rfileProc;
    aeFileProc *wfileProc;
    void *clientData;
} epollEvent;

typedef struct epollState
{
    int epfd;
    struct epoll_event *events;
} epollState;

typedef struct EventLoop
{
    int maxfd;
    int fds[2];
    int setSize;
    epollState eState;
    epollEvent *loopEvents;
} EventLoop;
typedef void aeFileProc(EventLoop *loop, int fd, void *clientData, int mask);

#endif